package com.kum.aspect;

import com.kum.service.UserCacheService;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @version V1.0
 * @Package com.kum.aspect
 * @auhter 枯木Kum
 * @date 2021/6/20-4:36 PM
 * <p>...</p>
 */

@Aspect
@Component
public class RefreshUserCacheAspect {

    @Autowired
    private UserCacheService userCacheService;

    @Pointcut("@annotation(com.kum.annotations.RefreshUserScriptCache)")
    public void refreshUserScriptCachePoinCut() {
    }

    @AfterReturning(value = "refreshUserScriptCachePoinCut()", returning="returnValue")
    public void refreshUserScriptCache(JoinPoint joinPoint, Object returnValue) {

        userCacheService.refreshUserScriptCache();
    }



}
